package com.qf.springboot.service.impl;

import com.qf.springboot.mapper.UserMapper;
import com.qf.springboot.pojo.User;
import com.qf.springboot.service.UserService;
import org.aspectj.weaver.ast.Var;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class UserServiceImpl implements UserService {

    private UserMapper userMapper;

    @Autowired
    public void setUserMapper(UserMapper userMapper) {
        this.userMapper = userMapper;
    }

    @Override
    public User findUserById(Long id) {
        return userMapper.findUserById(id);
    }

    @Override
    public void addUser(User user) {

        userMapper.addUser(user);
    }

    @Override
    public int updateUser(User user) {
        int user1 = userMapper.updateUser(user);

        return user1;
    }

    @Override
    public int deleteUserById(Long id) {
        int user = userMapper.deleteUserById(id);
        return user;
    }
}
